package com.basker.pisces.orm.statement;

import java.util.ArrayList;
import java.util.List;

import org.springframework.util.Assert;

public class BatchWriteStatement {

    private String sql;
    private List<Object[]> batchArguments;
    private int[] argumentTypes;

    public BatchWriteStatement(String sql) {
        this(sql, new ArrayList<>(), new int[0]);
    }

    public BatchWriteStatement(String sql, int[] argumentTypes) {
        this(sql, new ArrayList<>(), argumentTypes);
    }

    public BatchWriteStatement(String sql, List<Object[]> arguments) {
        this(sql, arguments, new int[0]);
    }

    public BatchWriteStatement(String sql, List<Object[]> batchArguments, int[] argumentTypes) {
        Assert.hasText(sql, "parameter 'sql' is required");

        this.sql = sql;
        this.batchArguments = batchArguments;
        this.argumentTypes = argumentTypes;
    }

    public void addArguments(Object[] arguments) {
        this.batchArguments.add(arguments);
    }

    public int[] getArgumentTypes() {
        return argumentTypes;
    }

    public List<Object[]> getBatchArguments() {
        return batchArguments;
    }

    public String getSql() {
        return sql;
    }

}
